<?php

namespace App\Api\Controllers;

use App\Api\Requests\ConversionRequest;
use App\Models\Address;
use App\Models\Comment;
use App\Models\Conversion;
use App\Models\UserLog;
use Illuminate\Http\Request;

class AddressController extends Controller
{
    public function store(Address $address,Request $request){
        $address->name = $request->input('name');
        $address->telephone = $request->input('telephone');
        $address->province = $request->input('province');
        $address->city = $request->input('city');
        $address->area = $request->input('area');
        $address->detailed = $request->input('detailed');
        $address->uid = $this->user()->id;
        $res = $address->save();
        return $this->success('成功');
    }

    public function index(){
        return $this->success($this->user()->address()->orderBy('id','desc')->get());
    }
}
